// 点击空白处关闭弹窗
export const clickOutSide = {
    beforeMount(el, binding) {
        const handleDocument = (e) => {
            // 判断是否元素本身
            if (el.contains(e.target)) return false
            if (binding.value) {
                // 如果绑定了方法，执行绑定的方法
                binding.value(e)
            }
        }
        el.__vueClickOutside__ = handleDocument
        document.addEventListener('click', handleDocument)
    },
    unmounted(el) {
        document.removeEventListener('click', el.__vueClickOutside__)
        delete el.__vueClickOutside__
    }
}


